package com.boost.bio.file;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

public class Test {
    public static void main(String[] args) throws IOException {
        String dir = "F:\\ABC";
        String fileName = "C.TXT";
        File dirFile = new File(dir);
        if (!dirFile.exists()) {
            dirFile.mkdirs();
        }
        File file = new File(dir + File.separator + fileName);
        if (!file.exists()) {
            file.createNewFile();
        }
        OutputStreamWriter write = new OutputStreamWriter(new FileOutputStream(dir + File.separator + fileName, true), "UTF-8");
        BufferedWriter writer = new BufferedWriter(write);
        Map map = new HashMap();
        map.put("abc", "sdfs");
        Iterator<String> it = map.keySet().iterator();
        while (it.hasNext()) {
            String key = it.next();
            Object value = map.get(key);
            writer.write(key + "=" + value + "\n");
        }
        writer.close();
        write.close();
    }
}
